package com.cxyd.modules.api.dto;

import lombok.Data;

import java.io.Serializable;

@Data
public class RcsResultHK implements Serializable {
    private static final long serialVersionUID = 1L;
    private String code;
    private String message;
    private ResultData data;

    public static class ResultData implements Serializable {
        private static final long serialVersionUID = 1L;
        private String robotTaskCode;

        public String getRobotTaskCode() {
            return robotTaskCode;
        }

        public void setRobotTaskCode(String robotTaskCode) {
            this.robotTaskCode = robotTaskCode;
        }

        @Override
        public String toString() {
            return "{" +
                    "robotTaskCode='" + robotTaskCode + '\'' +
                    '}';
        }
    }

    public RcsResultHK success(String robotTaskCode) {
        this.code = "SUCCESS";
        // 确保data对象不为null
        if (this.data == null) {
            this.data = new ResultData();
        }
        this.data.setRobotTaskCode(robotTaskCode);
        this.message = "成功";
        return this;
    }

    public RcsResultHK error(String robotTaskCode, String message) {
        this.code = "FAIL";
        // 确保data对象不为null
        if (this.data == null) {
            this.data = new ResultData();
        }
        this.data.setRobotTaskCode(robotTaskCode);
        this.message = message;
        return this;
    }
}
